package cn.iocoder.yudao.module.vote.controller.admin.fielddynamicsconfig.vo;

import cn.iocoder.yudao.module.vote.dal.dataobject.voteuserresult.VoteUserResultDO;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import lombok.*;
import java.util.*;
import java.util.function.Predicate;

import io.swagger.annotations.*;
import javax.validation.constraints.*;

@ApiModel("管理后台 - 表动态配置字段展示更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class FieldDynamicsConfigUpdateReqVO extends FieldDynamicsConfigBaseVO {

    @ApiModelProperty(value = "主键", required = true)
    @NotNull(message = "主键不能为空")
    private Long id;


    public static void main(String[] args) {
        String fieldsList = "id vote_id mobile user_name excellent qualified base_qualified unqualified quantified_score group_name unit_name position";
        List<Predicate<TableFieldInfo>> predicateList = new ArrayList<>();


//        TableInfo tableInfo = TableInfoHelper.getTableInfo(VoteUserResultDO.class);
//        List<TableFieldInfo> fieldList = tableInfo.getFieldList();



        for (String field : fieldsList.split(" ")) {
            // Predicate<TableFieldInfo> predicate = i -> i.getColumn().equals(tableFieldInfo.getColumn());
            //判断需要的字段
            Predicate<TableFieldInfo> predicate = i -> i.getColumn().equals(field);
            predicateList.add(predicate);
        }

        Predicate<TableFieldInfo> p =  predicateList.stream().reduce(i -> false, Predicate::and);
        System.out.println(p);
    }
}
